Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: Sound

| Previous | Chapter contents | Chapter top | Section top | Next |

Performing Unsigned Fixed-Point Arithmetic

This section describes the UnsignedFixMulDiv function provided by the Sound Manager that you can use to perform multiplication and division on unsigned fixed-point numbers.

UnsignedFixMulDiv

You can use the UnsignedFixMulDiv function to perform multiplications and divisions on unsigned fixed-point numbers. You'll typically use it to calculate sample rates.

FUNCTION UnsignedFixMulDiv (value: UnsignedFixed;
                                         multiplier: UnsignedFixed;
                                         divisor: UnsignedFixed):
                                         UnsignedFixed;
value
The value to be multiplied and divided.
multiplier
The multiplier to be applied to the value in the value parameter.
divisor
The divisor to be applied to the value in the value parameter.

DESCRIPTION

The UnsignedFixMulDiv function returns the fixed-point number that is the value of the value parameter, multiplied by the value in the multiplier parameter and divided by the value in the divisor parameter. Note that UnsignedFixMulDiv performs both operations before returning. If you want to perform only a multiplication or only a division, pass the value $00010000 for whichever parameter you want to ignore. For example, to determine the sample rate that is twice that of the 22 kHz rate, you can use UnsignedFixMulDiv as follows:

myNewRate := UnsignedFixMulDiv(rate22kHz, $00020000, $00010000);

Similarly, to determine the sample rate that is half that of the 44 kHz rate, you can use UnsignedFixMulDiv as follows:

myNewRate := UnsignedFixMulDiv(rate44kHz, $00010000, $00020000);

SPECIAL CONSIDERATIONS

The UnsignedFixMulDiv function is available only in versions 3.0 and later of the Sound Manager.


© 1999 Apple Computer, Inc.

| Previous | Chapter contents | Chapter top | Section top | Next |